package homework;

import java.io.*;

public class Test3 {
    public static void main(String[] args) throws IOException {
        //获取src/main/java/io目录下的当前子项
        File dir = new File("./src/main/java/io");
        //筛选目录下的.java文件
        File[] subs = dir.listFiles(f->f.getName().endsWith(".java"));
        //定义String型变量line
        String line;
        //遍历所有.java文件
        for (int i = 0; i <subs.length ; i++) {
            //获得每一个.java文件
            File sub = subs[i];
            //创建一个缓冲字符输入流
            BufferedReader br = new BufferedReader(
                    new InputStreamReader(
                            new FileInputStream(sub)));
            //判断快读文件时，读到当前字节是否为空
            while ((line =br.readLine())!=null){
                //输出
                System.out.println(line);

            }
        }
    }
}
